home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2000 / MacHack 2000.toast / pc / The Hacks / Softshoe / Lisa's Mac Parts / Clipboard / Cutter.cp < prev    next >
Text File  |  2000-06-23  |  696b  |  43 lines

  1. // Cutter.cp
  2.  
  3. #ifndef Cutter_h
  4. #include "Cutter.h"
  5. #endif
  6. #ifndef Clipboard_h
  7. #include "Clipboard.h"
  8. #endif
  9. #ifndef CantEditInBackground_h
  10. #include "CantEditInBackground.h"
  11. #endif
  12. #ifndef ApplicationFocus_h
  13. #include "ApplicationFocus.h"
  14. #endif
  15. #ifndef GlobalClipboard_h
  16. #include "GlobalClipboard.h"
  17. #endif
  18.  
  19. Cutter::Cutter( Clipboard& theClipboard )
  20.   : clipboard( theClipboard ),
  21.      approved( false )
  22.   {
  23.     if ( !ApplicationFocus::The().Active() )
  24.         throw CantEditInBackground();
  25.     
  26.     Clipboard::InvalidateAll();
  27.     GlobalClipboard::Invalidate();
  28.   }
  29.  
  30. Cutter::~Cutter()
  31.   {
  32.     if ( approved )
  33.         clipboard.Changed();
  34.      else
  35.        try
  36.          {
  37.             clipboard.Invalidate();
  38.           }
  39.          catch( ... )
  40.           {
  41.           }
  42.   }
  43.